package com.czy.workflow.core.listener;

import com.czy.workflow.core.context.FlowContext;
import com.czy.workflow.core.model.TaskInfo;


public class TaskListenerNotify implements TaskListener{

    private FlowContext flowContext;


    //TODO：listener分发消息


    @Override
    public void start(TaskInfo taskInfo) {
    }

    @Override
    public void before(TaskInfo taskInfo, boolean success) {
    }

    @Override
    public void after(TaskInfo taskInfo, boolean success) {
        //处理非主要功能的异常，防止影响主干任务
        try{
            flowContext.getFlowService().saveFlowLog(taskInfo, success);



        }catch (Exception e){

        }
    }

    @Override
    public void finished(TaskInfo taskInfo) {
    }

    public void setFlowContext(FlowContext flowContext) {
        this.flowContext = flowContext;
    }
}
